<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Txt2tags User Guide</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
<LINK REL="Start" HREF="index.html">
<LINK REL="Contents" HREF="index.html">
<LINK REL="Prev" HREF="preproc.html">
<LINK REL="Next" HREF="style.html">
<STYLE TYPE="text/css"><!--
BODY { font-family: serif }
H1 { font-family: sans-serif }
H2 { font-family: sans-serif }
H3 { font-family: sans-serif }
H4 { font-family: sans-serif }
H5 { font-family: sans-serif }
H6 { font-family: sans-serif }
SUB { font-size: smaller }
SUP { font-size: smaller }
PRE { font-family: monospace }
--></STYLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="userguide.css"></HEAD>
<BODY>
<A HREF="index.html">Contents</A>
<A HREF="preproc.html">Previous</A>
<A HREF="style.html">Next</A>
<HR NOSHADE>

<H2><A NAME="8_5">%!postproc</A></H2>
<P> The PostProc is an output filter that changes the converted
 document. It is a &quot;find and replace&quot; feature, applied after all
 txt2tags parsing and processing is done.</P>
<P> It is useful to do some refinements on the generated document,
 change tags and add extra text or tags. Quick samples:</P>
<PRE>
%!postproc(html): '&lt;BODY.*?&gt;' '&lt;BODY BGCOLOR=&quot;green&quot;&gt;'
%!postproc(tex) : &quot;\\newpage&quot; &quot;&quot;
</PRE>
<P> These filters change the background color of the HTML page and
 remove the page breaks on the LaTeX target.</P>
<P> The PostProc rules are just like an external Sed/Perl filter, called
 this way:</P>
<PRE>
$ txt2tags -t html -o- file.t2t | postproc-script.sh &gt; file.html
</PRE>
<P> Before this feature was introduced, it was very common to have
 little scripts to &quot;adjust&quot; the txt2tags results. These scripts were in
 fact just lots of sed (or alike) commands, to do &quot;substitute this for
 that&quot; actions. Now this replacement strings can be saved together with
 the document text, and the plus is to use the Python powerful Regular
 Expression machine to find patterns.</P>
 <A NAME="setting-style"></A><HR NOSHADE>
<A HREF="index.html">Contents</A>
<A HREF="preproc.html">Previous</A>
<A HREF="style.html">Next</A>
</BODY>
</HTML>
